﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Bymed.SpineScan.DataModel;

namespace Bymed.SpineScan.Repository.EntityFramework.Mapping
{
    public class CustomizedTestItemMap : EntityTypeConfiguration<CustomizedTestItem>
    {
        public CustomizedTestItemMap()
        {
            // Primary Key
            this.HasKey(t => t.ItemTimestamp);

            // Properties
            this.Property(t => t.ItemTimestamp)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.ItemTitle)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.ItemType)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("CustomizedTestItem");
            this.Property(t => t.ItemTimestamp).HasColumnName("ItemTimestamp");
            this.Property(t => t.ItemTitle).HasColumnName("ItemTitle");
            this.Property(t => t.ItemType).HasColumnName("ItemType");
            this.Property(t => t.OrderIndex).HasColumnName("OrderIndex");
        }
    }
}
